package cn.farm.farm.Mapper.CommonMapper;

import cn.farm.farm.Entity.Common.Protection;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface ProtectMapper {
        @Select("select * from protection where keyword like CONCAT('%',#{keyword},'%') or title like CONCAT('%',#{keyword},'%')")
        @Results({
                @Result(column = "protectionImage",property = "protectionImage",
                        many = @Many(select = "cn.farm.farm.Mapper.CommonMapper.MatchMapper.getimageID",fetchType= FetchType.EAGER))
        })
        List<Protection> likeSelect(@Param(value = "keyword") String keyword);

        @Select("select * from protection where knowID = #{protectid}")
        @Results({
                @Result(column = "protectionImage",property = "protectionImage",
                        many = @Many(select = "cn.farm.farm.Mapper.CommonMapper.MatchMapper.getimageID",fetchType= FetchType.EAGER))
        })
        Protection foundHotProtect(Integer protectid);
}
